const sliderWidth = 96
const helper = require("../../../utils/helper.js");

Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs: ['横版', '竖版'],
    tabBars: ['资料栏', '侧边式资料栏', '插入式资料栏', '底部式资料栏'],
    picCounts: ['图数', '5-6图', '7-9图', '10-13图'],
    tabsIdx: 1,
    tabBarsIdx: 0,
    picCountsIdx: 0,
    templateList: [
      {}
    ], // 横版所有样式
    imgCount: 4
  },

  /**
   * 横版、竖版切换
   */
  changeTabs: function(e) {
    this.setData({
      tabsIdx: e.detail.value
    })
  },

  verticalCountChange: function(e) {
    const imgCount = e.currentTarget.dataset.imgCount;
    this.setData({
      imgCount
    })
  },

  chooseImgs: function (e) {
    const {
      tabsIdx,
      imgCount
    } = this.data;
    wx.chooseImage({
      count: imgCount,
      sizeType: ['compressed'],
      sourceType: ['album', 'camera'],
      success(res) {
        const tempFilePaths = res.tempFilePaths;
        helper.settingStorage('TEMPFILEPATHS_INFO', { type: tabsIdx, imgCount, tempFilePaths});
        wx.navigateTo({
          url: `/pages/tools/chooseImgs/index`,
        })
      }
    })
  }
})